package com.sxz.sbs.module.telephone.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.telephone.view.TelBookDetailView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;

/**
 * 通讯录详情
 */

public class TelBookDetailPresenter extends RxPresenter<TelBookDetailView>{

    /**
     * 添加特别关心
     * @param map
     */
    public void addMangerMark (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().addMangerMark(map)
                .compose(RxUtil.<String>handleResult())
                .subscribeWith(new RxSubscriber<String>(mView,true){
                    @Override
                    public void onNext(String data) {
                        mView.onAddMangerMarkSuccess();
                    }
                })
        );
    }
    /**
     * 取消特别关心
     * @param map
     */
    public void cancelMangerMark (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().cancelMangerMark(map)
                .compose(RxUtil.<String>handleResult())
                .subscribeWith(new RxSubscriber<String>(mView,true){
                    @Override
                    public void onNext(String data) {
                        mView.onCancelMangerMarkSuccess();
                    }
                })
        );
    }
}
